package com.vehicle.common.redis.manager;

import com.vehicle.common.redis.connection.RedisConnectionFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by yantingbin on 2017/7/1.
 */
@Configuration
public class RedisCacheManagerFactory {
    @Bean
    @ConditionalOnMissingBean(name="cacheManager")
    public CacheManager cacheManager( RedisConnectionFactory factory){
           RedisCacheManager redisCacheManager=new RedisCacheManager();
           redisCacheManager.setFactory(factory);
           redisCacheManager.init();
           return redisCacheManager;
    }
}
